import { ProtocolComponent } from "@components/Apps/InertialNavigation/InertialNavigationComponent";
import sensorData from "@components/Apps/Simulation/sensorModel/sensor";
import { ClientMessage } from "@runtime/generate/message/ClientMessage";
import MessageHandler from "@runtime/module/Handler/MessageHandler";

export default class DeviceDataAdapterUpdateMessageHandler extends MessageHandler<ClientMessage.DeviceDataAdapterUpdateMessage> {
    protected async RunAsync(message: ClientMessage.DeviceDataAdapterUpdateMessage): Promise<void> {
        console.log(message, '传感器消息返回值++++++++++++++++++++++++++++++++++');
        // const newData = JSON.parse(message.Content)
        // console.log(newData);
        if (message.Id == 11002) {
            sensorData.Default.imageData.value = message.Content
        }
        if (message.Id == 11005) {
            const newData = JSON.parse(message.Content)
            sensorData.Default.lon.value = newData.Result.gnssBestPose.longitude.toFixed(5);//经度
            sensorData.Default.lat.value = newData.Result.gnssBestPose.latitude.toFixed(5);//纬度
        }
    }
}